package org.go.examples.example_01;

import org.go.scheduler.Scheduler;
import org.go.scheduler.StdSchedulerFactory;
import org.go.trigger.CronScheduleBuilder;
import org.go.trigger.Trigger;
import org.go.work.Work;
import org.go.work.WorkBuilder;

public class Main {

	public static void main(String[] args) throws Exception {
		// define the work and tie it to our MyTask class
		Work work = WorkBuilder.newWork(MyTask.class).withIdentity("job1", "group1").build();
		// Creates the scheduler.
		Scheduler scheduler = new StdSchedulerFactory().getScheduler("DefaultScheduler");
		// Schedules the task, once every 5 seconds.
		String cron = "*/5 * * * * ?";
		Trigger cronTrigger = CronScheduleBuilder.cronSchedule(cron).build();
		scheduler.scheduler(work, cronTrigger);
	}
}
